package demo.demo1;

public class SimpleFactory {
    public Coffee createCoffee(String type){
        Coffee coffee=null;
        switch (type){
            case "1":
                coffee=new AmericanCoffee();
                break;
            case "2":
                coffee=new LatteCoffee();
                break;
            default:
                throw new RuntimeException("对不起，您点的咖啡不存在");
        }
        return coffee;
    }
}
